﻿#include "DxLib.h"
#include "Mouse.h"

//メニュータグ
typedef struct {
	int strx , stry;
	char name[100];
	int over_x;
	int over_y;
	int MenuKazu;
	int Select;
	int Play;
	int backx;
	int backy;
}MENUT;


//メニュータグに代入
MENUT MenuTag[3][2]={{
	{100 , 350 , "はじめる" , 230 , 40, 2 , 0 , 0 , 60  , 340 },
	{400 , 350 , "操作方法" , 230 , 40 , 2 , 0 , 0 , 360 , 340 },
},
{
	{60 , 300 , "ノーマルモード" , 230 , 40, 2 , 0 , 0 , 50 , 290 },
	{360 , 300 , "ブーストモード" , 230 , 40, 2 , 0 , 0 , 350 , 290},
},
{
	{ 70 , 400 , "記録を見る" , 230 ,40 , 2, 0 ,0 , 50 , 390 },
	{ 430, 400 , "戻る" , 230 , 40 , 2 , 0 ,0 , 350 , 390 }  ,
}
};


//定義
static int S_Click = 0;		//音　クリック
static int G_Menu = 0;		//画像　メニューのバック
static int S_Select = 0;	//音　選択
static int G_TrueMenu=0;



//メニュータグの初期化-----------------------------------------------------------------------------------------------------------------------------
void MenuTag_Init()
{
	//ロード

	S_Click = LoadSoundMem("dat/音/click.wav");
	G_Menu = LoadGraph("dat/画像/menuback.png");
	S_Select = LoadSoundMem("dat/音/select.ogg");
	ChangeVolumeSoundMem(100,S_Select);
}



//メニュータグを表示し、選択したかまでチェック----------------------------------------------------------------------------------------------------------------
int ClacDrawMenuTag(int number , int Color , int Font)
{
	int i=0;

	
	for(i=0;i<2;i++){

		//計算フェーズ----------------------------------------------------------------------------------------------------------
		if(ClickMousePoint(MenuTag[number][i].backx ,MenuTag[number][i].over_x , MenuTag[number][i].backy , MenuTag[number][i].over_y , FALSE , FALSE)==1){

			if(MenuTag[number][i].Play==FALSE ){

				PlaySoundMem( S_Select,DX_PLAYTYPE_BACK);
				MenuTag[number][i].Play=TRUE;
			}

		}else{

			MenuTag[number][i].Play=FALSE;
		}

		if(ClickMousePoint(MenuTag[number][i].backx ,MenuTag[number][i].over_x , MenuTag[number][i].backy , MenuTag[number][i].over_y , TRUE , S_Click )==1){
			return i;
		}



		//描写フェーズ-----------------------------------------------------------------------------------------------------------

		switch(MenuTag[number][i].Play){

			case FALSE:

				SetDrawBlendMode(DX_BLENDMODE_ALPHA,150);
				DrawGraph(MenuTag[number][i].backx , MenuTag[number][i].backy , G_Menu,TRUE);
				SetDrawBlendMode(DX_BLENDMODE_NOBLEND,0);
																		 
				break;
			case TRUE:

				DrawGraph(MenuTag[number][i].backx , MenuTag[number][i].backy , G_Menu , TRUE);
				
				break;
		}

		DrawStringToHandle(MenuTag[number][i].strx , MenuTag[number][i].stry , MenuTag[number][i].name , Color , Font	);

	}


	return 100;
}